﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>其他绩效数据信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/Content/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/Content/X-admin/lib/layui/layui.js"></script>
    <link href="~/Content/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/Content/X-admin/js/jquery.min.js"></script>
    <script src="~/Content/X-admin/js/xadmin.js"></script>
    <script src="~/Content/Scripts/Basis/UserJs.js"></script>
    <link href="~/Content/Scripts/Select2/select2.min.css" rel="stylesheet" />
    <script src="~/Content/Scripts/Select2/select2.min.js"></script>
    <script src="~/Content/Scripts/System/systemFrame.js"></script>
    <script src="~/Content/Scripts/System/Common.js"></script>
    <script type="text/html" id="barDemo">
        <a title="编辑" href="javascript:;" lay-event="edit"><i class="layui-icon">&#xe642;</i></a>
        <a title="删除" href="javascript:;" lay-event="del"><i class="layui-icon">&#xe640;</i></a>
    </script>

</head>
<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                            <div class="layui-inline layui-show-xs-block">

                                <input type="text" name="wCode" placeholder="绩效编码" autocomplete="off" class="layui-input" id="wCode">
                            </div>
                            <div class="layui-inline layui-show-xs-block">

                                <input type="text" name="userName" placeholder="绩效名称" autocomplete="off" class="layui-input" id="userName">
                            </div>

                            <div class="layui-inline layui-show-xs-block">
                                <button class="layui-btn" lay-filter="sreach" id="userSearch" type="button" onclick="loadData()"><i class="layui-icon">&#xe615;</i></button>
                           
                            </div>
                     


                        </form>
                    </div>
                    <div class="layui-card-header">
                        <button class="layui-btn layui-btn-normal" id="userAdd" type="button" onclick="openWin()"><i class="layui-icon"></i>添加</button>

                    </div>
                    <div class="layui-card-body layui-table-body layui-table-main">
                        <table class="layui-hide" id="list" lay-filter="list"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

<script>

    function loadData() {
        layui.use('table', function () {
            var conditon = JSON.stringify(FormToJson("qForm"));
            var table = layui.table;
            table.render({
                elem: '#list'
            , cols: [[ //标题栏
               { field: 'id', title: 'ID', width: 80 }
             , { field: 'sCode', title: '绩效编码', width: 90 }
             , { field: 'sName', title: '绩效名称', width: 180 }
             , { field: 'money', title: '金额', width: 80 }
             , { field: 'createtime', title: '提交时间', width: 150 }
           , { field: 'right', title: '操作', toolbar: '#barDemo', width: 70, fixed: 'right' }
            ]], done: function (res, curr, count) {
                $("[data-field='id']").css('display', 'none');//隐藏列
            }
            , height: $(document).height() - $('#list').offset().top - 20
            , url: "../Basis/GetDataList?dataType=other&condition=" + conditon
            , skin: 'row' //表格风格
            , even: true
            , page: true //是否显示分页
            , limits: [20, 30, 50]
            , limit: 20 //每页默认显示的数量
            });
            //监听工具条
            table.on('tool(list)', function (obj) {
                var data = obj.data;
                var done = "1";
                if (data.approveTime != "") {
                    done = "0";
                }
                if (obj.event === 'edit') {
                    InfoOpenPage('../Basis/UpdateOther?dataId=' + data.id, data.sName + "-编辑", "85%", "90%");
                } else if (obj.event === 'del') {
                    layer.confirm('确认要删除该数据？', function (index) {
                        var info = DelData(data.id);
                        if (info.Result) {
                            obj.del();
                        } else {
                            layer.msg(info.Message);
                        }
                        layer.close(index);
                    });
                }
            });

        });
    }
    $(function () {
        //获取列表
        loadData();
    })
    layui.use(['laydate'], function () {
        var $ = layui.$;
        var laydate = layui.laydate;
        var nowTime = new Date().valueOf();
        var max = null;
        var start = laydate.render({
            elem: '#start_time',
            trigger: 'click',
            type: 'datetime',
            format: 'yyyy/MM/dd',
            max: nowTime,
            btns: ['clear', 'confirm'],

            done: function (value, date) {
                endMax = end.config.max;
                end.config.min = date; //最大时间为结束时间的开始值
                end.config.min.month = date.month - 1;
            }
        });
        var end = laydate.render({
            elem: '#end_time',
            trigger: 'click',
            type: 'datetime',
            max: 4073558400000,
            format: 'yyyy/MM/dd',
            done: function (value, date) {
                if ($.trim(value) == '') {
                    var curDate = new Date();
                    date = { 'date': curDate.getDate(), 'month': curDate.getMonth() + 1, 'year': curDate.getFullYear() };
                }
                start.config.max = date;//最小时间为开始时间的最大值
                start.config.max.month = date.month - 1;
            }
        })
    })
    function openWin() {
        InfoOpenPage("../Basis/UpdateOther?dataId=0", "添加其他绩效", "85%", "90%");
    }
    function DelData(dataId) {
        var info = undefined;
        $.ajax({
            url: "../Basis/DelStandardById",
            data: { dataId: dataId },
            dataType: "json",
            type: "POST",
            async: false,
            success: function (data) {

                info = data;
            }
        });
        return info;
    }
</script>